<%--
    Document   : manageFood
    Created on : Feb 18, 2013, 5:06:59 PM
    Author     : DungTT
--%>

<%@page pageEncoding="UTF-8" contentType='text/html;charset=UTF-8'%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<script language='javascript' src="js/jquery.js" type="text/javascript"></script>

<style media="all" type="text/css">

    @import "css/displaytag.css";
    #foodEssential {width:190px;height:120px;padding:10px;border:1px solid #aaaaaa;}
    #foodNoEssential {width:190px;height:120px;padding:10px;border:1px solid #aaaaaa;}
</style>
<script src="js/displayTagAjax.js">
</script>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Manage Food Page</title>
        <script type="text/javascript" >
            function onload()
            {
                if(sessionScope.dishResults != null)
                {
                    document.getElementById('btnSearch').click();
                }
            }
        </script>
    </head>
    <body>

        <jsp:include page="homeHeader.jsp"/>
        <div class="searchDishFood">
        <form action="ControllerServlet" method="POST" >
            Tên đô ăn: <input type="text" name="txtFoodName" value="" />
            <input type="submit" value="SearchFoodCus" name="btnAction" id="btnSearch" />
        </form>
        </div>
        <div id="ajxDspId" style="width:60%" >
            <c:choose>
                <c:when test="${empty sessionScope.resultFood }">
                    <h2>Food not found</h2>
                </c:when>
                <c:otherwise>
                    <display:table name="sessionScope.resultFood" pagesize="8"
                                   export="false" sort="list" id="row" >
                        <display:column property="foodName" title="Food Name"
                                        sortable="true" headerClass="sortable" />
                        <display:column property="calorie" title="Calories"
                                        sortable="true" headerClass="Image" />
                        <display:column property="carb" title="Carb"
                                        sortable="true" headerClass="Image" />
                        <display:column property="protein" title="Protein"
                                        sortable="true" headerClass="Image" />
                        <display:column property="fat" title="Fat"
                                        sortable="true" headerClass="Image" />
                        <display:column title="Image" sortable="true"
                                        headerClass="sortable" >
                            <img alt=""  src="${pageContext.request.contextPath}/images/food/${row.imageURL}" width="200" height="200"/>
                        </display:column>
                    </display:table>
                </c:otherwise>
            </c:choose>
        </div>

    </body>
</html>
